{include file=header.html}
<script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
<script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
<script type="text/javascript">
$(function(){
     $('#buyer_form').validate({
        onkeyup : false,
		onfocusout : false,
		rules : {
			buyer_name: {
				required: true,
//				remote: 'index.php?app=buyer&act=check_buyer&buyer_name=' + $('#buyer_name').val() + '{if $smarty.get.act eq 'edit'}&id={$smarty.get.buyer_id}{/if}'
			},
			company_id: {
				min: 1
			},
			user_id: {
				min: 1
			}
		},
		messages : {
			buyer_name: {
				required: '{$lang.buyer_name_not_empty}',
				remote: '{$lang.buyer_is_exist}'
			},
			company_id: {
				min: '{$lang.company_select_pls}'
			},
			user_id: {
				min: '{$lang.user_select_pls}'
			}
		}
	 });
});
</script>
<style>
label.error {margin-left:2em; color:#FF0000;}
.tab-frame{width:900px;}
</style>
<body>
<div class="sub-body">
<div class="tab-frame">
<div class="tab-title-1">
<!--{if $smarty.get.act eq 'add'}--><span>{$lang.add_new_buyer}</span><!--{else}--><span>{$lang.edit_buyer}</span><!--{/if}-->
</div>
<form action="{url app=buyer&act=$smarty.get.act}{if $smarty.get.buyer_id}&amp;buyer_id={$smarty.get.buyer_id}{/if}" method="post" id="buyer_form">
<table width="100%" cellspacing="0" cellpadding="0" class="tab-display">
	<tr>
		<th width="100" align="right">{$lang.buyer_name}：</th>
		<td align="left"><input type="text" name="buyer_name" id="buyer_name" value="{$buyer.buyer_name}" class="input-1" /></td>
	</tr>
	<tr>
		<th align="right">{$lang.company}：</th>
		<td align="left">
			<select name="company_id">
				<option value="0">{$lang.select_pls}</option>
				<!--{foreach from=$companys item=company}-->
				<option value="{$company.company_id}" {if $buyer.company_id == $company.company_id} selected{/if}>{$company.company_name}</option>
				<!--{/foreach}-->
			</select>
		</td>
	</tr>
	<tr>
		<th align="right">{$lang.merchandiser}：</th>
		<td align="left">
		<select name="user_id">
			<option value="0">{$lang.select_pls}</option>
			<!--{foreach from=$users item=user}-->
			<option value="{$user.user_id}" {if $buyer.user_id == $user.user_id} selected{/if}>{$user.user_name}</option>
			<!--{/foreach}-->
		</select>
		</td>
	</tr>
	<tr>
		<th align="right">{$lang.if_show}：</th>
		<td align="left"><label><input type="radio" name="if_show" value="1" {if $buyer.if_show == 1}checked="checked"{/if} />{$lang.yes}</label>&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="if_show" value="0" {if $buyer.if_show == 0}checked="checked"{/if} />{$lang.no}</label></td>
	</tr>
	<tr>
		<td colspan="2" align="center"><input type="submit" value="{$lang.submit}" class="btn-2" /></td>
	</tr>
</table>
</form>
<script language="javascript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
</div>
</div>
</body>
</html>